package com.jy.wms;


import org.jeecgframework.poi.handler.impl.ExcelDataHandlerDefaultImpl;
import org.jeecgframework.poi.util.PoiPublicUtil;

import java.util.Map;

public class MapImportHanlder extends ExcelDataHandlerDefaultImpl {

    @Override
    public void setMapValue(Map<String, Object> map, String originKey, Object value) {
        if (value instanceof Double) {
            map.put(getRealKey(originKey), PoiPublicUtil.doubleToString((Double) value));
        } else {
            map.put(getRealKey(originKey), value != null ? value.toString() : null);
        }
    }

    private String getRealKey(String originKey) {
        System.out.println(originKey);
        if (originKey.equals("编号")) {
            return "bh";
        }
        if (originKey.equals("真实姓名")) {
            return "xm";
        }
        if (originKey.equals("密码")) {
            return "mm";
        }
        return originKey;
    }
}
